<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <!-- Latest compiled and minified CSS & JS -->
    <link rel="stylesheet" media="screen" href="//netdna.bootstrapcdn.com/bootstrap/3.1.0/css/bootstrap.min.css">
    <style>
        body{
            background: white;
        }
    </style>
</head>
<body>

<div class="container">
    <div class="row" >
        <nav class="navbar navbar-default" role="navigation">
            <!-- Brand and toggle get grouped for better mobile display -->
            <div class="navbar-header">
                <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse">
                    <span class="sr-only">Toggle navigation</span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
                <a class="navbar-brand" href="#">班级管理系统</a>
            </div>


        </nav>
        <div class="col-sm-3">
            <div class="list-group">
                <a href="/" class="list-group-item list-group-item-action active">班级管理</a>
                <a href="?c=student&a=index" class="list-group-item list-group-item-action">学生管理</a>
            </div>
        </div>
        <div class="col-sm-9">
            <div class="panel panel-default">
                <div class="panel-heading">
                    <h3 class="panel-title">班级管理</h3>
                </div>
                <div class="panel-body">
                    <table class="table table-hover">
                        <thead>
                        <tr>
                            <th>编号</th>
                            <th>名称</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody>
                            <?php foreach ($data  as $k=>$v){?>
                            <tr>
                                <td><?php echo $v['id']?></td>
                                <td><?php echo $v['name']?></td>
                                <td>
                                    <div class="btn-group btn-group-xs">
                                        <a href="?a=edit&id=<?php echo $v['id']?>" type="button" class="btn btn-primary">编辑</a>
                                        <button onclick="del(<?php echo $v['id']?>)" type="button" class="btn btn-danger">删除</>
                                    </div>
                                </td>
                            </tr>
                        <?php }?>
                        </tbody>
                    </table>
                    <a href="?a=add" class="btn btn-primary">添加班级</a>
                </div>
            </div>
        </div>

    </div>
</div>
<script>
    function  del(id){
        if(confirm('确认删除第'+id+'条数据')){
            location.href="?a=del&id="+id;
        }
    }
</script>
</body>
</html>